package com.appspot.diasporajava.dao.jpa;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Component;

import com.appspot.diasporajava.dao.PodDao;
import com.appspot.diasporajava.entities.Pod;

//@Component
public class PodDaoJPA extends GenericDaoJPAImpl<Pod,Long> implements PodDao<Pod,Long>{
	/* (non-Javadoc)
	 * @see com.appspot.diasporajava.dao.jpa.PodDao#findByUrl(java.lang.String)
	 */
	@Override
	public List<Pod> findByUrl(String url){
		final StringBuffer queryString = new StringBuffer("SELECT o from ");
		queryString.append(type.getSimpleName()).append(" o ");
		queryString.append(" where domainName = '").append(url).append("'");

		final Query query = this.emf.createEntityManager().createQuery(queryString.toString());

		return query.getResultList();
	}
}
